import ajax from './ajax'
import mockAjax from '@/mock/mockAjax'


export const reqGetCategoryListDate = () => ajax.get('/api/product/getBaseCategoryList')

export const reqGetBannerListDate = () => mockAjax.get('/banner')

export const reqGetFloorListDate = () => mockAjax.get('/floor')

//根据搜索参数获取搜索数据
export const reqGetGoodsInfoData = (searchProps) => ajax.post('/api/list',searchProps)

export const reqGetGoodDetailInfoData =(id)=> ajax.get('/api/item/' + id) 

export const reqAddOrUpdataCart = (skuId, skuNum) => ajax.post(`/api/cart/addToCart/${skuId}/${skuNum}`)

export const reqShopCartListData = ()  =>  ajax.get('/api/cart/cartList') 

export const reqChangeShopCartInfoState = (skuID,isChecked) => ajax.get(`/api/cart/checkCart/${skuID}/${isChecked}`)

//批量更新购物车选中的商品
export const reqUpdateShopCartInfoState = (sukIdList,isChecked) => {
    return ajax ({
        url:`/api/cart/batchCheckCart/${isChecked}`,
        method: 'post',
        data:sukIdList
    })
}

//删除一条选中商品
export const reqDelOneShopCrtInfo = (skuId) => {
    return ajax({
        url:`/api/cart/deleteCart/${skuId}`,
        method:'delete'
    })
}

//删除选中的多个商品
export const reqDelCheckedShopInfo = (skuIdList) => ajax.delete(`/api/cart/batchDeleteCart`, skuIdList)

//获取验证码
export const reqGetPhoneCodeNumber = phoneNumber => ajax.get(`/api/user/passport/sendCode/${phoneNumber}`)

// 注册账号
export const reqUserRegister = (userObj) => ajax.post('/api/user/passport/register',userObj)

//登录账号
export const reqUserLogin = (user) => ajax.post('/api/user/passport/login',user)

// 登出
export const loginUserOut = () => ajax.get('/api/user/passport/logout')

//获取用户的收获地址
export const reqUserAddressList = () => ajax.get('/api/user/userAddress/auth/findUserAddressList')

//获取用户支付的商品信息
export const reqUserTradeInfo = () => ajax.get('/api/order/auth/trade')

export const reqSubmitOrder = (tradeNo, params) => ajax.post(`/api/order/auth/submitOrder?tradeNo=${tradeNo}`,params)

// 18. 获得订单支付信息  也就是获取支付二维码
export const reqPayQrcode =(orderId)=> ajax.get(`/api/payment/weixin/createNative/${orderId}`)